home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q1082.dms / q1082.adf / src.lzh / Fig / move.c < prev    next >
C/C++ Source or Header  |  1991-07-18  |  4KB  |  142 lines

  1. /* 
  2.  *    FIG : Facility for Interactive Generation of figures
  3.  *
  4.  *    Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
  5.  *    January 1985.
  6.  *    1st revision : Aug 1985.
  7.  *
  8.  *    %W%    %G%
  9. */
  10. #include "fig.h"
  11. #include "resources.h"
  12. #include "font.h"
  13. #include "func.h"
  14. #include "object.h"
  15. #include "paintop.h"
  16.  
  17. #define            TOLERANCE    3
  18.  
  19. extern            (*canvas_kbd_proc)();
  20. extern            (*canvas_locmove_proc)();
  21. extern            (*canvas_leftbut_proc)();
  22. extern            (*canvas_middlebut_proc)();
  23. extern            (*canvas_rightbut_proc)();
  24. extern            (*return_proc)();
  25. extern            null_proc();
  26. extern            set_popupmenu();
  27.  
  28. extern F_line        *line_search();
  29. extern F_arc        *arc_search();
  30. extern F_ellipse    *ellipse_search();
  31. extern F_text        *text_search();
  32. extern F_spline        *spline_search();
  33. extern F_compound    *compound_search();
  34.  
  35. extern int        foreground_color, background_color;
  36. extern int        pointmarker_shown, compoundbox_shown;
  37. extern int        last_object;
  38. extern int        last_action;
  39.  
  40.             init_move();
  41.  
  42. move_selected()
  43. {
  44.     canvas_kbd_proc = null_proc;
  45.     canvas_locmove_proc = null_proc;
  46.     canvas_leftbut_proc = init_move;
  47.     canvas_middlebut_proc = null_proc;
  48.     canvas_rightbut_proc = set_popupmenu;
  49.     return_proc = move_selected;
  50.     set_cursor(&pick9_cursor);
  51.     reset_action_on();
  52.     }
  53.  
  54. init_move(x, y)
  55. int    x, y;
  56. {
  57.     F_line        *l;
  58.     F_arc        *a;
  59.     F_ellipse    *e;
  60.     F_text        *t;
  61.     F_spline    *s;
  62.     F_compound    *c;
  63.     int        px, py;
  64.  
  65.     if ((c = compound_search(x, y, TOLERANCE, &px, &py)) != NULL) {
  66.         set_temp_cursor(&wait_cursor);
  67.         win_setmouseposition(canvas_swfd, px, py);
  68.         if (compoundbox_shown) draw_compoundbox(c, INV_PAINT);
  69.         erase_compound(c);
  70.         init_compounddragging(c, px, py);
  71.         set_temp_cursor(&null_cursor);
  72.         clean_up();
  73.         set_action_object(F_MOVE, O_COMPOUND);
  74.         set_latestcompound(c);
  75.         }
  76.     else if ((l = line_search(x, y, TOLERANCE, &px, &py)) != NULL) {
  77.         set_temp_cursor(&wait_cursor);
  78.         erase_pointmarker();
  79.         win_setmouseposition(canvas_swfd, px, py);
  80.         draw_line(l, ERASE);
  81.         init_linedragging(l, px, py);
  82.         set_temp_cursor(&null_cursor);
  83.         clean_up();
  84.         set_action_object(F_MOVE, O_POLYLINE);
  85.         set_latestline(l);
  86.         }
  87.     else if ((t = text_search(x, y)) != NULL) {
  88.         set_temp_cursor(&wait_cursor);
  89.         erase_pointmarker();
  90.         pw_text(canvas_pixwin, t->base_x, t->base_y, 
  91.         INV_PAINT, canvas_font, t->cstring);
  92.         init_textdragging(t, x, y);
  93.         set_temp_cursor(&null_cursor);
  94.         clean_up();
  95.         set_action_object(F_MOVE, O_TEXT);
  96.         set_latesttext(t);
  97.         }
  98.     else if ((e = ellipse_search(x, y, TOLERANCE, &px, &py)) != NULL) {
  99.         set_temp_cursor(&wait_cursor);
  100.         erase_pointmarker();
  101.         set_temp_cursor(&null_cursor);
  102.         win_setmouseposition(canvas_swfd, px, py);
  103.         pw_batch_on(canvas_pixwin);
  104.         draw_ellipse(e, background_color);
  105.         pw_batch_off(canvas_pixwin);
  106.         init_ellipsedragging(e, px, py);
  107.         set_temp_cursor(&null_cursor);
  108.         clean_up();
  109.         set_action_object(F_MOVE, O_ELLIPSE);
  110.         set_latestellipse(e);
  111.         }
  112.     else if ((a = arc_search(x, y, TOLERANCE, &px, &py)) != NULL) {
  113.         set_temp_cursor(&wait_cursor);
  114.         erase_pointmarker();
  115.         win_setmouseposition(canvas_swfd, px, py);
  116.         pw_batch_on(canvas_pixwin);
  117.         draw_arc(a, background_color);
  118.         pw_batch_off(canvas_pixwin);
  119.         init_arcdragging(a, px, py);
  120.         set_temp_cursor(&null_cursor);
  121.         clean_up();
  122.         set_action_object(F_MOVE, O_ARC);
  123.         set_latestarc(a);
  124.         }
  125.     else if ((s = spline_search(x, y, TOLERANCE, &px, &py)) != NULL) {
  126.         set_temp_cursor(&wait_cursor);
  127.         win_setmouseposition(canvas_swfd, px, py);
  128.         erase_pointmarker();
  129.         pw_batch_on(canvas_pixwin);
  130.         draw_spline(s, ERASE);
  131.         pw_batch_off(canvas_pixwin);
  132.         init_splinedragging(s, px, py);
  133.         set_temp_cursor(&null_cursor);
  134.         clean_up();
  135.         set_action_object(F_MOVE, O_SPLINE);
  136.         set_latestspline(s);
  137.         }
  138.     else
  139.         return;
  140.     canvas_leftbut_proc = canvas_rightbut_proc = null_proc;
  141.     }
  142.